package com.jzo2o.customer.controller.operation;

import cn.hutool.core.bean.BeanUtil;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.model.domain.AgencyCertification;
import com.jzo2o.customer.model.domain.AgencyCertificationAudit;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.request.ServeProviderPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationAuditResDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationResDTO;
import com.jzo2o.customer.model.dto.response.ServeProviderListResDTO;
import com.jzo2o.customer.model.dto.response.WorkerCertificationAuditResDTO;
import com.jzo2o.customer.service.AgencyCertificationAuditService;
import com.jzo2o.customer.service.IAgencyCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author itcast
 */
@RestController("operationAgencyCertificationController")
@RequestMapping("/operation/agency-certification-audit")
@Api(tags = "运营端 - 机构认证信息相关接口")
public class AgencyCertificationController {

    @Resource
    private IAgencyCertificationService agencyCertificationService;



    @Resource
    private AgencyCertificationAuditService agencyCertificationAuditService;

    @GetMapping("/{id}")
    @ApiOperation("根据机构id查询认证信息")
    public AgencyCertificationResDTO queryById(@PathVariable("id") Long id) {
        return BeanUtil.toBean(agencyCertificationService.getById(id), AgencyCertificationResDTO.class);
    }

    @GetMapping("/page")
    @ApiOperation("服务人员分页查询")
    public PageResult<AgencyCertificationAudit> page(AgencyCertificationAuditPageQueryReqDTO agencyDTO) {
        return agencyCertificationAuditService.pageQueryWorker(agencyDTO);
    }

    @PutMapping ("/audit/{id}")
    @ApiOperation("审核机构认证信息")
    public void audit(@PathVariable("id") Long id, @RequestBody AgencyCertificationAudit agencyCertificationAudit) {
        agencyCertificationAuditService.audit(id,agencyCertificationAudit);
    }
}
